from flask import Flask
from flask_script import Manager
from flask_sqlalchemy import SQLAlchemy

class Application(Flask):
    def __init__(self, name):
        super(Application, self).__init__(name)
        # 设置配置文件
        self.config.from_pyfile('config/base_setting.py')
        # 将生成环境和开发环境分开
        import os
        env = os.environ
        if 'ops_config' in env:
            self.config.from_pyfile('config/%s_setting.py' % env['ops_config'])
        db.init_app(self)


# 初始化数据库
db = SQLAlchemy()
app = Application(__name__)
manager = Manager(app)








